import logging

from redis import StrictRedis


class Config(object):
    """工程配置信息"""
    DEBUG = True

    SECRET_KEY ="NowwKR+s0Zyd7xZtS+0LD8glg26shSexjgVYoF+ZTDDQrIjq7yqiBaeBoZHDC3pU"
#     数据库的配置信息
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # redis配置
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    #flask_session的配置
    SESSION_TYPE = 'redis' #指定 session保存到redis
    SESSION_USE_SOGNR = True #让cookie 中session_id加密签名处理
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT) #指定Session储存在redis
    SESSION_PERMANENT= False #设置过期时间
    PERMANENT_SESSION_LIFETIME = 86400 * 2 #设置过期时间 86400一天
    #默认logo日志等级
    LOG_LEVEL = logging.DEBUG

class DevelopmentConfig(Config):
    "开发环境配置"
    DEBUG = True

class ProductionConfig(Config):
    "生产环境配置"
    DEBUG = False
    LOG_LEVEL = logging.ERROR

class TestingConfig(Config):
    "开发环境配置"
    DEBUG = True
    TESTIN = True


config ={
    "development":DevelopmentConfig,
    "production":ProductionConfig,
    "testing":TestingConfig
}

